import { Form, Input } from 'antd';
import React from 'react';

const RoleForm = ({ form, isEditing }) => {
  return (
    <Form form={form} layout="vertical">
      {isEditing ? (
        <>
          <Form.Item name="roleId" label="角色ID" hidden>
            <Input />
          </Form.Item>
          <Form.Item 
            name="roleCode" 
            label="角色编码" 
            rules={[{ required: true, message: '请输入角色编码' }]}
          >
            <Input placeholder="请输入角色编码" disabled />
          </Form.Item>
          <Form.Item 
            name="roleName" 
            label="角色名称" 
            rules={[{ required: true, message: '请输入角色名称' }]}
          >
            <Input placeholder="请输入角色名称" />
          </Form.Item>
        </>
      ) : (
        <>
          <Form.Item 
            name="roleCode" 
            label="角色编码" 
            rules={[{ required: true, message: '请输入角色编码' }]}
          >
            <Input placeholder="请输入角色编码" />
          </Form.Item>
          <Form.Item 
            name="roleName" 
            label="角色名称" 
            rules={[{ required: true, message: '请输入角色名称' }]}
          >
            <Input placeholder="请输入角色名称" />
          </Form.Item>
        </>
      )}
      <Form.Item name="remark" label="备注">
        <Input.TextArea placeholder="请输入备注" rows={4} />
      </Form.Item>
    </Form>
  );
};

export default RoleForm;